package br.pucrio.inf.lac.konoha.hyuga.listeners;

import java.util.Set;

import org.apache.log4j.Logger;

import br.pucrio.inf.lac.konoha.hyuga.common.Grid;
import br.pucrio.inf.lac.konoha.hyuga.common.Pair;
import br.pucrio.inf.lac.konoha.hyuga.events.grid.UnlockCellDisperseEvent;

public class GridWriteUnlockListener {

    /** LOGGER. */
    private static Logger LOGGER = Logger.getLogger(GridWriteUnlockListener.class.getCanonicalName());
    
    public void update(UnlockCellDisperseEvent cellDisperse) {
        String threadName = Thread.currentThread().getName();
        LOGGER.debug(threadName + "(" + cellDisperse.getX() + ", " + cellDisperse.getY() + ") in DISPERSION LISTENER trying to do write unlock.");
        
        Grid.gridWriteUnlock();
    }
    
    public void update(Set<Pair<Integer, Integer>> cluster) {
        String threadName = Thread.currentThread().getName();
        LOGGER.debug(threadName + "in MERGE LISTENER trying to do write unlock.");

        Grid.gridWriteUnlock();
    }

}
